﻿
using System.Net;
using System.Web.Mvc;
using Dexter.Logger.Contracts;
using Dexter.Search;
using Dexter.Services;
using Dexter.Web.Mvc.Filters;
using Dexter.Web.Mvc.ViewModel.ViewsData;
using Dexter.Web.Mvc.ViewsData;
using Dexter.Web.Utils;

namespace Dexter.Web.Mvc.Controllers.FrontEnd {
	[DexterCallFilter ( true )]
	public class ErrorController : PublicControllerBase {
		public ErrorController ( ISearchService searchService , ICommentService commentService , IReferrerService referrerService , IConfigurationService configurationService , IWebUtils webUtils , ILogger logger , IUrlBuilder urlBuilder , IBlogRollService blogRollService , ICategoryService categoryService , IPostService postService , IThemeManager themeManager , ITagService tagService , IPageService pageService ) : base ( searchService , commentService , referrerService , configurationService , webUtils , logger , urlBuilder , blogRollService , categoryService , postService , themeManager , tagService , pageService ) {}

		[AcceptVerbs(HttpVerbs.Get | HttpVerbs.Head)]
		public ViewResult Unknown ( string aspxerrorpath ) {
			Response.StatusCode = ( int )HttpStatusCode.InternalServerError;
			return View (( object )aspxerrorpath );
		}

		[AcceptVerbs(HttpVerbs.Get | HttpVerbs.Head)]
		public ViewResult Forbidden ( string aspxerrorpath ) {
			Response.StatusCode = ( int )HttpStatusCode.Forbidden;
			return View ( ( object )aspxerrorpath );
		}

		[AcceptVerbs(HttpVerbs.Get | HttpVerbs.Head)]
		public ViewResult NotFound ( string aspxerrorpath ) {
			var data = base.GetViewData ( new PublicBaseViewData ( base.WebUtils , base.Configuration , base.UrlBuilder ) );
			Response.StatusCode = ( int )HttpStatusCode.NotFound;
			return View ( data );
		}
	}
}
